package cn.gzjp.modules.logis.entity;

import cn.gzjp.common.config.Global;
import cn.hutool.core.util.StrUtil;
import org.hibernate.validator.constraints.Length;

import cn.gzjp.common.persistence.DataEntity;
import cn.gzjp.common.utils.excel.annotation.ExcelField;

/**
 * 常见问题Entity
 * @author zengcp
 * @version 2018-04-10
 */
public class LogisQuestion extends DataEntity<LogisQuestion> {
	
	private static final long serialVersionUID = 1L;
	private String title;		// 标题
	private String content;		// 内容
	private String sort;		// 排序

	private String type;		// 1常见问题 2积分

	private String appId;  //小程序
	
	public LogisQuestion() {
		super();
	}

	public LogisQuestion(String id){
		super(id);
	}

	@Length(min=0, max=128, message="标题长度必须介于 0 和 128 之间")
	@ExcelField(title="标题", align=2, sort=1)
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	@ExcelField(title="内容", align=2, sort=2)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	@Length(min=0, max=11, message="排序长度必须介于 0 和 11 之间")
	@ExcelField(title="排序", align=2, sort=4)
	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getHtmlContent() {
		String standa = "";
		if(StrUtil.isNotBlank(this.getContent())){
			standa = this.getContent().replaceAll("<img src=\"/static/ueditor/", "<img src=\"https://wuliu.bailingtech.cn/static/ueditor/");
		}
		return standa;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}
}